clear all

load Welfare_gamma_0_GE Welfare_gamma_0_GE
load Welfare_gamma_1_PE Welfare_gamma_1_PE
load Welfare_gamma_1_GE Welfare_gamma_1_GE
load Welfare_gamma_1_GE_rev_neut Welfare_gamma_1_GE_rev_neut

load wage_moments_gamma_0_GE wage_moments_gamma_0_GE
load wage_moments_gamma_1_PE wage_moments_gamma_1_PE
load wage_moments_gamma_1_GE wage_moments_gamma_1_GE
load wage_moments_gamma_1_GE_rev_neut wage_moments_gamma_1_GE_rev_neut

load HH_states_gamma_0_GE HH_states_gamma_0_GE
load HH_states_gamma_1_PE HH_states_gamma_1_PE
load HH_states_gamma_1_GE HH_states_gamma_1_GE
load HH_states_gamma_1_GE_rev_neut HH_states_gamma_1_GE_rev_neut

load Agg_stocks_gamma_0_GE Agg_stocks_gamma_0_GE
load Agg_stocks_gamma_1_PE Agg_stocks_gamma_1_PE
load Agg_stocks_gamma_1_GE Agg_stocks_gamma_1_GE
load Agg_stocks_gamma_1_GE_rev_neut Agg_stocks_gamma_1_GE_rev_neut

load wage_moments_under_f_0_GE
wage_moments_F_all=wage_moments_under_F;
load wage_moments_under_f_gamma_1_PE
wage_moments_F_all=[wage_moments_F_all,wage_moments_under_F];
load wage_moments_under_f_gamma_1_GE
wage_moments_F_all=[wage_moments_F_all,wage_moments_under_F];
load wage_moments_under_f_gamma_1_GE_rev_neut
wage_moments_F_all=[wage_moments_F_all,wage_moments_under_F];

load Transitions_gamma_0_GE Transitions_gamma_0_GE
load Transitions_gamma_1_PE Transitions_gamma_1_PE
load Transitions_gamma_1_GE Transitions_gamma_1_GE
load Transitions_gamma_1_GE_rev_neut Transitions_gamma_1_GE_rev_neut

load Profit_gamma_0_GE Profit_gamma_0_GE
load Profit_gamma_1_PE Profit_gamma_1_PE
load Profit_gamma_1_GE Profit_gamma_1_GE
load Profit_gamma_1_GE_rev_neut Profit_gamma_1_GE_rev_neut

load Firm_size_gamma_0_GE Firm_size_gamma_0_GE
load Firm_size_gamma_1_PE Firm_size_gamma_1_PE
load Firm_size_gamma_1_GE Firm_size_gamma_1_GE
load Firm_size_gamma_1_GE_rev_neut Firm_size_gamma_1_GE_rev_neut

%table wage percentiles - under F distribution - head informal
Head_Informal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = 100*(wage_moments_F_all(:,6)-wage_moments_F_all(:,2));
time2_GE = 100*(wage_moments_F_all(:,10)-wage_moments_F_all(:,2));
time2_GE_rev_neut = 100*(wage_moments_F_all(:,14)-wage_moments_F_all(:,2));
T1_Counter_Head_I_distF = table (Head_Informal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Head_I_distF, 'MEXICO_Counter_Head_I_distF.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - under F distribution - head formal
Head_Formal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = 100*(wage_moments_F_all(:,5)-wage_moments_F_all(:,1));
time2_GE = 100*(wage_moments_F_all(:,9)-wage_moments_F_all(:,1));
time2_GE_rev_neut = 100*(wage_moments_F_all(:,13)-wage_moments_F_all(:,1));
T1_Counter_Head_F_distF = table (Head_Formal_Sector_pct,time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Head_F_distF, 'MEXICO_Counter_Head_F_distF.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - under F distribution - spouse informal
Spouse_Informal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = 100*(wage_moments_F_all(:,8)-wage_moments_F_all(:,4));
time2_GE = 100*(wage_moments_F_all(:,12)-wage_moments_F_all(:,4));
time2_GE_rev_neut = 100*(wage_moments_F_all(:,16)-wage_moments_F_all(:,4));
T1_Counter_Spouse_I_distF = table (Spouse_Informal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Spouse_I_distF, 'MEXICO_Counter_Spouse_I_distF.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - under F distribution - head formal
Spouse_Formal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = 100*(wage_moments_F_all(:,7)-wage_moments_F_all(:,3));
time2_GE = 100*(wage_moments_F_all(:,11)-wage_moments_F_all(:,3));
time2_GE_rev_neut = 100*(wage_moments_F_all(:,15)-wage_moments_F_all(:,3));
T1_Counter_Spouse_F_distF = table (Spouse_Formal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Spouse_F_distF, 'MEXICO_Counter_Spouse_F_distF.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - head informal
Head_Informal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = [100*(wage_moments_gamma_1_PE(9) - wage_moments_gamma_0_GE(9))/wage_moments_gamma_0_GE(9);...
    100*(wage_moments_gamma_1_PE(13) - wage_moments_gamma_0_GE(13))/wage_moments_gamma_0_GE(13);...
    100*(wage_moments_gamma_1_PE(17) - wage_moments_gamma_0_GE(17))/wage_moments_gamma_0_GE(17);...
    100*(wage_moments_gamma_1_PE(21) - wage_moments_gamma_0_GE(21))/wage_moments_gamma_0_GE(21);...
    100*(wage_moments_gamma_1_PE(25) - wage_moments_gamma_0_GE(25))/wage_moments_gamma_0_GE(25);...
    100*(wage_moments_gamma_1_PE(1) - wage_moments_gamma_0_GE(1))/wage_moments_gamma_0_GE(1)];
time2_GE = [100*(wage_moments_gamma_1_GE(9) - wage_moments_gamma_0_GE(9))/wage_moments_gamma_0_GE(9);...
    100*(wage_moments_gamma_1_GE(13) - wage_moments_gamma_0_GE(13))/wage_moments_gamma_0_GE(13);...
    100*(wage_moments_gamma_1_GE(17) - wage_moments_gamma_0_GE(17))/wage_moments_gamma_0_GE(17);...
    100*(wage_moments_gamma_1_GE(21) - wage_moments_gamma_0_GE(21))/wage_moments_gamma_0_GE(21);...
    100*(wage_moments_gamma_1_GE(25) - wage_moments_gamma_0_GE(25))/wage_moments_gamma_0_GE(25);...
    100*(wage_moments_gamma_1_GE(1) - wage_moments_gamma_0_GE(1))/wage_moments_gamma_0_GE(1)];
time2_GE_rev_neut = [100*(wage_moments_gamma_1_GE_rev_neut(9) - wage_moments_gamma_0_GE(9))/wage_moments_gamma_0_GE(9);...
    100*(wage_moments_gamma_1_GE_rev_neut(13) - wage_moments_gamma_0_GE(13))/wage_moments_gamma_0_GE(13);...
    100*(wage_moments_gamma_1_GE_rev_neut(17) - wage_moments_gamma_0_GE(17))/wage_moments_gamma_0_GE(17);...
    100*(wage_moments_gamma_1_GE_rev_neut(21) - wage_moments_gamma_0_GE(21))/wage_moments_gamma_0_GE(21);...
    100*(wage_moments_gamma_1_GE_rev_neut(25) - wage_moments_gamma_0_GE(25))/wage_moments_gamma_0_GE(25);...
    100*(wage_moments_gamma_1_GE_rev_neut(1) - wage_moments_gamma_0_GE(1))/wage_moments_gamma_0_GE(1)];
T1_Counter_Head_I = table (Head_Informal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Head_I, 'MEXICO_Counter_Head_I_Renata.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - head formal
Head_Formal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = [100*(wage_moments_gamma_1_PE(10) - wage_moments_gamma_0_GE(10))/wage_moments_gamma_0_GE(10);...
    100*(wage_moments_gamma_1_PE(14) - wage_moments_gamma_0_GE(14))/wage_moments_gamma_0_GE(14);...
    100*(wage_moments_gamma_1_PE(18) - wage_moments_gamma_0_GE(18))/wage_moments_gamma_0_GE(18);...
    100*(wage_moments_gamma_1_PE(22) - wage_moments_gamma_0_GE(22))/wage_moments_gamma_0_GE(22);...
    100*(wage_moments_gamma_1_PE(26) - wage_moments_gamma_0_GE(26))/wage_moments_gamma_0_GE(26);...
    100*(wage_moments_gamma_1_PE(2) - wage_moments_gamma_0_GE(2))/wage_moments_gamma_0_GE(2)];
time2_GE = [100*(wage_moments_gamma_1_GE(10) - wage_moments_gamma_0_GE(10))/wage_moments_gamma_0_GE(10);...
    100*(wage_moments_gamma_1_GE(14) - wage_moments_gamma_0_GE(14))/wage_moments_gamma_0_GE(14);...
    100*(wage_moments_gamma_1_GE(18) - wage_moments_gamma_0_GE(18))/wage_moments_gamma_0_GE(18);...
    100*(wage_moments_gamma_1_GE(22) - wage_moments_gamma_0_GE(22))/wage_moments_gamma_0_GE(22);...
    100*(wage_moments_gamma_1_GE(26) - wage_moments_gamma_0_GE(26))/wage_moments_gamma_0_GE(26);...
    100*(wage_moments_gamma_1_GE(2) - wage_moments_gamma_0_GE(2))/wage_moments_gamma_0_GE(2)];
time2_GE_rev_neut = [100*(wage_moments_gamma_1_GE_rev_neut(10) - wage_moments_gamma_0_GE(10))/wage_moments_gamma_0_GE(10);...
    100*(wage_moments_gamma_1_GE_rev_neut(14) - wage_moments_gamma_0_GE(14))/wage_moments_gamma_0_GE(14);...
    100*(wage_moments_gamma_1_GE_rev_neut(18) - wage_moments_gamma_0_GE(18))/wage_moments_gamma_0_GE(18);...
    100*(wage_moments_gamma_1_GE_rev_neut(22) - wage_moments_gamma_0_GE(22))/wage_moments_gamma_0_GE(22);...
    100*(wage_moments_gamma_1_GE_rev_neut(26) - wage_moments_gamma_0_GE(26))/wage_moments_gamma_0_GE(26);...
    100*(wage_moments_gamma_1_GE_rev_neut(2) - wage_moments_gamma_0_GE(2))/wage_moments_gamma_0_GE(2)];
T1_Counter_Head_F = table (Head_Formal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Head_F, 'MEXICO_Counter_Head_F_Renata.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - spouse informal
Spouse_Informal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = [100*(wage_moments_gamma_1_PE(11) - wage_moments_gamma_0_GE(11))/wage_moments_gamma_0_GE(11);...
    100*(wage_moments_gamma_1_PE(15) - wage_moments_gamma_0_GE(15))/wage_moments_gamma_0_GE(15);...
    100*(wage_moments_gamma_1_PE(19) - wage_moments_gamma_0_GE(19))/wage_moments_gamma_0_GE(19);...
    100*(wage_moments_gamma_1_PE(23) - wage_moments_gamma_0_GE(23))/wage_moments_gamma_0_GE(23);...
    100*(wage_moments_gamma_1_PE(27) - wage_moments_gamma_0_GE(27))/wage_moments_gamma_0_GE(27);...
    100*(wage_moments_gamma_1_PE(3) - wage_moments_gamma_0_GE(3))/wage_moments_gamma_0_GE(3)];
time2_GE = [100*(wage_moments_gamma_1_GE(11) - wage_moments_gamma_0_GE(11))/wage_moments_gamma_0_GE(11);...
    100*(wage_moments_gamma_1_GE(15) - wage_moments_gamma_0_GE(15))/wage_moments_gamma_0_GE(15);...
    100*(wage_moments_gamma_1_GE(19) - wage_moments_gamma_0_GE(19))/wage_moments_gamma_0_GE(19);...
    100*(wage_moments_gamma_1_GE(23) - wage_moments_gamma_0_GE(23))/wage_moments_gamma_0_GE(23);...
    100*(wage_moments_gamma_1_GE(27) - wage_moments_gamma_0_GE(27))/wage_moments_gamma_0_GE(27);...
    100*(wage_moments_gamma_1_GE(3) - wage_moments_gamma_0_GE(3))/wage_moments_gamma_0_GE(3)];
time2_GE_rev_neut = [100*(wage_moments_gamma_1_GE_rev_neut(11) - wage_moments_gamma_0_GE(11))/wage_moments_gamma_0_GE(11);...
    100*(wage_moments_gamma_1_GE_rev_neut(15) - wage_moments_gamma_0_GE(15))/wage_moments_gamma_0_GE(15);...
    100*(wage_moments_gamma_1_GE_rev_neut(19) - wage_moments_gamma_0_GE(19))/wage_moments_gamma_0_GE(19);...
    100*(wage_moments_gamma_1_GE_rev_neut(23) - wage_moments_gamma_0_GE(23))/wage_moments_gamma_0_GE(23);...
    100*(wage_moments_gamma_1_GE_rev_neut(27) - wage_moments_gamma_0_GE(27))/wage_moments_gamma_0_GE(27);...
    100*(wage_moments_gamma_1_GE_rev_neut(3) - wage_moments_gamma_0_GE(3))/wage_moments_gamma_0_GE(3)];
T1_Counter_Spouse_I = table (Spouse_Informal_Sector_pct,  time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Spouse_I, 'MEXICO_Counter_Spouse_I_Renata.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table wage percentiles - spouse formal
Spouse_Formal_Sector_pct = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'}
time2_PE = [100*(wage_moments_gamma_1_PE(12) - wage_moments_gamma_0_GE(12))/wage_moments_gamma_0_GE(12);...
    100*(wage_moments_gamma_1_PE(16) - wage_moments_gamma_0_GE(16))/wage_moments_gamma_0_GE(16);...
    100*(wage_moments_gamma_1_PE(20) - wage_moments_gamma_0_GE(20))/wage_moments_gamma_0_GE(20);...
    100*(wage_moments_gamma_1_PE(24) - wage_moments_gamma_0_GE(24))/wage_moments_gamma_0_GE(24);...
    100*(wage_moments_gamma_1_PE(28) - wage_moments_gamma_0_GE(28))/wage_moments_gamma_0_GE(28);...
    100*(wage_moments_gamma_1_PE(4) - wage_moments_gamma_0_GE(4))/wage_moments_gamma_0_GE(4)];
time2_GE = [100*(wage_moments_gamma_1_GE(12) - wage_moments_gamma_0_GE(12))/wage_moments_gamma_0_GE(12);...
    100*(wage_moments_gamma_1_GE(16) - wage_moments_gamma_0_GE(16))/wage_moments_gamma_0_GE(16);...
    100*(wage_moments_gamma_1_GE(20) - wage_moments_gamma_0_GE(20))/wage_moments_gamma_0_GE(20);...
    100*(wage_moments_gamma_1_GE(24) - wage_moments_gamma_0_GE(24))/wage_moments_gamma_0_GE(24);...
    100*(wage_moments_gamma_1_GE(28) - wage_moments_gamma_0_GE(28))/wage_moments_gamma_0_GE(28);...
    100*(wage_moments_gamma_1_GE(4) - wage_moments_gamma_0_GE(4))/wage_moments_gamma_0_GE(4)];
time2_GE_rev_neut = [100*(wage_moments_gamma_1_GE_rev_neut(12) - wage_moments_gamma_0_GE(12))/wage_moments_gamma_0_GE(12);...
    100*(wage_moments_gamma_1_GE_rev_neut(16) - wage_moments_gamma_0_GE(16))/wage_moments_gamma_0_GE(16);...
    100*(wage_moments_gamma_1_GE_rev_neut(20) - wage_moments_gamma_0_GE(20))/wage_moments_gamma_0_GE(20);...
    100*(wage_moments_gamma_1_GE_rev_neut(24) - wage_moments_gamma_0_GE(24))/wage_moments_gamma_0_GE(24);...
    100*(wage_moments_gamma_1_GE_rev_neut(28) - wage_moments_gamma_0_GE(28))/wage_moments_gamma_0_GE(28);...
    100*(wage_moments_gamma_1_GE_rev_neut(4) - wage_moments_gamma_0_GE(4))/wage_moments_gamma_0_GE(4)];
T1_Counter_Spouse_F = table (Spouse_Formal_Sector_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Spouse_F, 'MEXICO_Counter_Spouse_F_Renata.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table stocks variation
Stocks_pp = {'mff_h'; 'mfi_h'; 'mfn_h'; 'mif_h'; 'mnf_h'; 'mii_h'; 'min_h'; 'mni_h'; 'mnn_h';'mff'; 'mfi'; 'mfn'; 'mif'; 'mnf'; 'mii'; 'min'; 'mni'; 'mnn'};
time2_PE = [100*(HH_states_gamma_1_PE - HH_states_gamma_0_GE)];
time2_GE = [100*(HH_states_gamma_1_GE - HH_states_gamma_0_GE)];
time2_GE_rev_neut = [100*(HH_states_gamma_1_GE_rev_neut - HH_states_gamma_0_GE)];
T1_Counter_stocks = table (Stocks_pp, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_stocks,'MEXICO_Counter_stocks_Renata.xls');
clear time2_PE time2_GE time2_GE_rev_neut

%table welfare variation
Welfare_variation_pct = {'Average';'Average_h';'Average_l'; 'Head formal'; 'Head Informal'; 'Head Unemployed'; 'Spouse formal'; 'Spouse Informal'; 'Spouse Unemployed'};
time2_PE = zeros(9,1); 
for i =1:9
    time2_PE(i) = 100*(Welfare_gamma_1_PE(i) - Welfare_gamma_0_GE(i))/Welfare_gamma_0_GE(i);
end
time2_GE = zeros(9,1); 
for i =1:9
    time2_GE(i) = 100*(Welfare_gamma_1_GE(i) - Welfare_gamma_0_GE(i))/Welfare_gamma_0_GE(i);
end
time2_GE_rev_neut = zeros(9,1); 
for i =1:9
    time2_GE_rev_neut(i) = 100*(Welfare_gamma_1_GE_rev_neut(i) - Welfare_gamma_0_GE(i))/Welfare_gamma_0_GE(i);
end
T1_Counter_Welfare = table(Welfare_variation_pct, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_Counter_Welfare,'MEXICO_Counter_Welfare_Renata.xls')
clear time2_PE time2_GE time2_GE_rev_neut

%table Aggregate stocks varitaion
Agg_stock_pp = {'Household Inf';'Unemployment Head';'Unemployment Spouse'};
time2_PE = 100*(Agg_stocks_gamma_1_PE - Agg_stocks_gamma_0_GE);
time2_GE = 100*(Agg_stocks_gamma_1_GE - Agg_stocks_gamma_0_GE);
time2_GE_rev_neut = 100*(Agg_stocks_gamma_1_GE_rev_neut - Agg_stocks_gamma_0_GE);
T1_counter_agg_stocks = table(Agg_stock_pp, time2_PE, time2_GE, time2_GE_rev_neut);
writetable(T1_counter_agg_stocks, 'MEXICO_counter_agg_stocks_Renata.xls');

%table transitions variation
Transitions_name = {'Unemployed-Formal';'Unemployed-Informal';'Formal-Unemployment'; ...
    'Formal-Informal';'Informal-Unemployed';'Informal-Formal'; 'Unemployed_Informal if other spouse loses formal job'; 'Unemployed_Informal if other spouse loses formal job'};
time2_PE_head = 100*(Transitions_gamma_1_PE(:,1) - Transitions_gamma_0_GE(:,1));
time2_GE_head = 100*(Transitions_gamma_1_GE(:,1) - Transitions_gamma_0_GE(:,1));
time2_GE_rev_neut_head = 100*(Transitions_gamma_1_GE_rev_neut(:,1) - Transitions_gamma_0_GE(:,1));
time2_PE_spouse = 100*(Transitions_gamma_1_PE(:,2) - Transitions_gamma_0_GE(:,2));
time2_GE_spouse = 100*(Transitions_gamma_1_GE(:,2) - Transitions_gamma_0_GE(:,2));
time2_GE_rev_neut_spouse = 100*(Transitions_gamma_1_GE_rev_neut(:,2) - Transitions_gamma_0_GE(:,2));
T_transitions_head = table(Transitions_name,time2_PE_head,time2_GE_head,time2_GE_rev_neut_head);
T_transitions_spouse = table(Transitions_name,time2_PE_spouse,time2_GE_spouse,time2_GE_rev_neut_spouse);
writetable(T_transitions_head, 'MEXICO_transitions_head.xls');
writetable(T_transitions_spouse, 'MEXICO_transitions_spouse.xls');

%table profits
Profit_percent = {'Total profit - head';'Profit per worker formal - head';'Profit per worker informal - head';'';'Total profit - spouse';'Profit per worker formal - spouse';'Profit per worker informal - spouse'};
time2_PE=100*(Profit_gamma_1_PE-Profit_gamma_0_GE)./Profit_gamma_0_GE;
time2_GE=100*(Profit_gamma_1_GE-Profit_gamma_0_GE)./Profit_gamma_0_GE;
time2_GE_rev_neut=100*(Profit_gamma_1_GE_rev_neut-Profit_gamma_0_GE)./Profit_gamma_0_GE;
T_profits=table(Profit_percent,time2_PE,time2_GE,time2_GE_rev_neut);
writetable(T_profits, 'MEXICO_profits.xls');

%table firm size
Size_labels = {'10th'; '25th'; '50th'; '75th'; '90th'; 'mean'};
time2_PE=100*(Firm_size_gamma_1_PE-Firm_size_gamma_0_GE)./Firm_size_gamma_0_GE;
time2_GE=100*(Firm_size_gamma_1_GE-Firm_size_gamma_0_GE)./Firm_size_gamma_0_GE;
time2_GE_rev_neut=100*(Firm_size_gamma_1_GE_rev_neut-Firm_size_gamma_0_GE)./Firm_size_gamma_0_GE;
T_size_head_formal=table(Size_labels,time2_PE(:,1),time2_GE(:,1),time2_GE_rev_neut(:,1));
T_size_head_informal=table(Size_labels,time2_PE(:,2),time2_GE(:,2),time2_GE_rev_neut(:,2));
T_size_spouse_formal=table(Size_labels,time2_PE(:,3),time2_GE(:,3),time2_GE_rev_neut(:,3));
T_size_spouse_informal=table(Size_labels,time2_PE(:,4),time2_GE(:,4),time2_GE_rev_neut(:,4));
writetable(T_size_head_formal, 'MEXICO_firm_size_head_formal.xls');
writetable(T_size_head_informal, 'MEXICO_firm_size_head_informal.xls');
writetable(T_size_spouse_formal, 'MEXICO_firm_size_spouse_formal.xls');
writetable(T_size_spouse_informal, 'MEXICO_firm_size_spouse_informal.xls');